package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202410;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class leetcode20241008 {
    public String destCity(List<List<String>> paths){
        /**
         * 旅行的终点：没有出度的点
         */
        Set<String> start=new HashSet<>();
        Set<String> end=new HashSet<>();

        for(List<String> path : paths){
            start.add(path.get(0));
            end.add(path.get(1));
        }

        for(String pos : end){
            if(!start.contains(pos)) return pos;
        }

        return "";
    }
}
